if (((SMList->ChunkySupport&4)&&(pixformats&RGB16))||((SMList->ChunkySupport&32)&&(pixformats&BGR24))||((SMList->ChunkySupport&2)&&(pixformats&RGB24))||((SMList->ChunkySupport&256)&&(pixformats&RGBA32))||((SMList->ChunkySupport&32768)&&(pixformats&&BGRA32))||((SMList->ChunkySupport&1)&&(pixformats&ARGB32))||((SMList->ChunkySupport&16384)&&(pixformats&BGR16PC))||((SMList->ChunkySupport&8192)&&(pixformats&RGB16PC))||((SMList->ChunkySupport&4096)&&(pixformats&BGR15PC))||((SMList->ChunkySupport&2048)&&(pixformats&RGB15PC))||((SMList->ChunkySupport&64)&&(pixformats&BGR16))||((SMList->ChunkySupport&128)&&(pixformats&BGR15))||((SMList->ChunkySupport&8)&&(pixformats&RGB15))||((SMList->ChunkySupport&512)&&(pixformats&LUT8)))
{
// If the Screenmode supports 8 Bit (Bit 9 set) and
// if the engine supports LUT8
// Get Width and height
char *hilf;
width=(SMList->StandardOverscan).Width;
height=(SMList->StandardOverscan).Height;
if (!strstr(SMList->Name,"TestScreen"))
{
// Get Boardname for later Screenmode comparision...
int TrueColor;
TrueColor=0;
strcpy(&BoardName[0],SMList->Name);
hilf=strstr(&BoardName[0],":");
hilf[0]='\0';
// Set Maximum resolutions :
// No Maximum for 8 Bit
// 640x480 for 16 Bit
// 320x240 for 24 Bit
if ((SMList->ChunkySupport&1)||(SMList->ChunkySupport&32768)||(SMList->ChunkySupport&256)||(SMList->ChunkySupport&2)||(SMList->ChunkySupport&32)) TrueColor=1;
if ((width>=320)&&(height>=200)&&(((width<=640)&&(height<=480))||(SMList->ChunkySupport&512))&&(((width<=320)&&(height<=240))||(!(TrueColor))))
{
// Now transform rtgmaster Screenmode format to AmigaQuake
// Screenmode Format
if (video=AllocVec(sizeof(vmode_t),MEMF_PUBLIC|MEMF_CLEAR))
{
if (firstvideo) oldvideo->pnext=video;
else firstvideo=video;
oldvideo=video;
video->ID = SMList->ModeID;
video->width= width;
video->height= height;
// Set rowbytes according to Screen-Depth
if (SMList->ChunkySupport&512) video->rowbytes=video->width;
else if (SMList->ChunkySupport&1) video->rowbytes=4*(video->width);
else if (SMList->ChunkySupport&32768) video->rowbytes=4*(video->width);
else if (SMList->ChunkySupport&256) video->rowbytes=4*(video->width);
else if (SMList->ChunkySupport&2) video->rowbytes=3*(video->width);
else if (SMList->ChunkySupport&32) video->rowbytes=3*(video->width);
else video->rowbytes=2*(video->width);
video->setpalette = &RTGM_SetPalette;
video->setmode = &RTGM_SetMode;
video->closemode= &RTGM_CloseMode;
// Set Swapbuffers function according to Screen-Depth
if (SMList->ChunkySupport&512) video->swapbuffers = &RTGM8_SwapBuffers;
else if (SMList->ChunkySupport&1) video->swapbuffers= &RTGM32_SwapBuffers;
else if (SMList->ChunkySupport&32768) video->swapbuffers= &RTGM32_SwapBuffers;
else if (SMList->ChunkySupport&256) video->swapbuffers= &RTGM32_SwapBuffers;
else if (SMList->ChunkySupport&2) video->swapbuffers= &RTGM24_SwapBuffers;
else if (SMList->ChunkySupport&32) video->swapbuffers= &RTGM24_SwapBuffers;
else video->swapbuffers=&RTGM16_SwapBuffers;
video->sendkeyevents=&Sys_SendKeyEvents;
// Set BeginDirectRect Function according to Screen-Depth
if (SMList->ChunkySupport&512) video->begindirectrect = &RTGM8_BeginDirectRect;
else if (SMList->ChunkySupport&1) video->begindirectrect= &RTGM32_BeginDirectRect;
else if (SMList->ChunkySupport&32768) video->begindirectrect= &RTGM32_BeginDirectRect;
else if (SMList->ChunkySupport&256) video->begindirectrect= &RTGM32_BeginDirectRect;
else if (SMList->ChunkySupport&2) video->begindirectrect= &RTGM24_BeginDirectRect;
else if (SMList->ChunkySupport&32) video->begindirectrect= &RTGM24_BeginDirectRect;
// As we do not use the Screenmode-Requester of rtgmaster.library,
// we have to "fake" a ScreenReq Structure...
// Set the Screen-Depth according to the Pixelformat
if (pcurrentmode->type==PIXFMT_LUT8) myscreenreq.Depth=8;
else if ((pcurrentmode->type==PIXFMT_ARGB32)||(pcurrentmode->type==PIXFMT_BGRA32)||(pcurrentmode->type==PIXFMT_RGBA32)||(pcurrentmode->type==PIXFMT_RGB24)||(pcurrentmode->type==PIXFMT_BGR24)) myscreenreq.Depth=24;
else myscreenreq.Depth=16;
pmodetype=pcurrentmode->type;
// Normally the Screenmode-Requester sets the flags, as we do not use the
// Screenmode-Requester of rtgmaster, we have to do this ourselves...
myscreenreq.Flags=14;
myscreenreq.Overscan=0;
currentbuffer=0;
// The Screenmode-entry of ScreenReq is a bit difficult to find
if (((SMList->ChunkySupport&512)||(SMList->ChunkySupport&1)||(SMList->ChunkySupport&4)||(SMList->ChunkySupport&64)||(SMList->ChunkySupport&2048)||(SMList->ChunkySupport&128)||(SMList->ChunkySupport&4096)||(SMList->ChunkySupport&8192)||(SMList->ChunkySupport&16384)||(SMList->ChunkySupport&32768)||(SMList->ChunkySupport&256)||(SMList->ChunkySupport&2)||(SMList->ChunkySupport&32)||(SMList->ChunkySupport&8))&&((pformat&LUT8)||(pformat&ARGB32)||(pformat&BGR16)||(pformat&BGR15)||(pformat&RGB16)||(pformat&BGR24)||(pformat&RGB24)||(pformat&RGBA32)||(pformat&BGRA32)||(pformat&BGR16PC)||(pformat&RGB16PC)||(pformat&BGR15PC)||(pformat&RGB15PC)||(pformat&RGB15))&&(!strstr(SMList->Name,"TestScreen")))
{
// Replace RtgMaster: again with BoardName: and compare
// Screenmodes
char hilf[255];
char *hilf2;
char *q;
strcpy(&hilf[0],BoardName);
hilf2=strstr(pcurrentmode->name,":");
strcat(&hilf[0],": ");
hilf2++;
strcat(&hilf[0],hilf2);
hilf2=&hilf[0];
q=hilf2;
while (*hilf2!=0)
{
if ((*hilf2=='x')&&convert)
{
*q++='×';
*hilf2++;
// Only convert back, if conversion is needed. Conversion is
// NOT needed for CyberGraphX 3 for example. CyberGraphX 3
if ((rtgmtype==MOVE16)||(rtgmtype==MOVEM)||(rtgmtype==RTGMASTER))
{
if (pcurrentmode->type==PIXFMT_LUT8) {lvid->buffer=AllocMem(lvid->width*lvid->height,MEMF_FAST|MEMF_CLEAR);}
else if ((pcurrentmode->type==PIXFMT_ARGB32)||(pcurrentmode->type==PIXFMT_BGRA32)||(pcurrentmode->type==PIXFMT_RGBA32)) lvid->buffer=AllocMem(lvid->width*lvid->height*4,MEMF_FAST|MEMF_CLEAR);
else if ((pcurrentmode->type==PIXFMT_RGB24)||(pcurrentmode->type==PIXFMT_BGR24)) lvid->buffer=AllocMem(lvid->width*lvid->height*3,MEMF_FAST|MEMF_CLEAR);
if ((rtgmextravram==1)&&(rtgmtype!=MOVE16)&&(rtgmtype!=MOVEM)&&(rtgmtype!=RTGMASTER)) extravram=GetBufAdr(rtgm_scr,2);
else if (rtgmextravram==1) extravram=GetBufAdr(rtgm_scr,1);
if (pcurrentmode->type==PIXFMT_LUT8) rtgm_backingbuf=AllocMem(24*24,MEMF_FAST|MEMF_CLEAR);
else if ((pcurrentmode->type==PIXFMT_RGB24)||(pcurrentmode->type==PIXFMT_BGR24)) rtgm_backingbuf=AllocMem(24*24*3,MEMF_FAST|MEMF_CLEAR);
else if ((pcurrentmode->type==PIXFMT_ARGB32)||(pcurrentmode->type==PIXFMT_BGRA32)||(pcurrentmode->type==PIXFMT_RGBA32)) rtgm_backingbuf=AllocMem(24*24*4,MEMF_FAST|MEMF_CLEAR);